/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.contract.feign;

import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.common.security.annotation.Inner;
import com.pig4cloud.pigx.contract.api.feign.ContractOrderFeign;
import com.pig4cloud.pigx.contract.dto.ContractRobotPlaceOrderDTO;
import com.pig4cloud.pigx.contract.service.ContractOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 订单feign
 *
 * @date 2022-08-11 10:08:11
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/feign/order")
public class ContractOrderFeignImpl implements ContractOrderFeign {

	private final ContractOrderService contractOrderService;

	/**
	 * 新增多条订单-kLine机器人
	 *
	 * @param dtoList dtoList
	 * @param from    标注内部调用
	 * @return {@link R}
	 * @date 2022/8/28 16:52
	 */
	@Inner
	@Override
	@SysLog("feign接口调用新增多条订单-kLine机器人")
	@PostMapping(ADD_MULTI_ROBOT_K_LINE)
	public R addMultiRobotKLine(List<ContractRobotPlaceOrderDTO> dtoList, String from) {
		contractOrderService.newOrderMultiRobotKLine(dtoList);
		return R.ok();
	}
}
